package org.jeecg.modules.demo.drfpapers.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.demo.drfpapers.entity.DrfPapers;
import org.jeecg.modules.demo.drfpapers.mapper.DrfPapersMapper;
import org.jeecg.modules.demo.drfpapers.service.IDrfPapersService;

import java.util.List;

/**
 * @Description: 论文表
 * @Author: jeecg-boot
 * @Date:   2025-10-02
 * @Version: V1.0
 */
@Service
public class DrfPapersServiceImpl extends ServiceImpl<DrfPapersMapper, DrfPapers> implements IDrfPapersService {

    @Autowired
    private DrfPapersMapper drfPapersMapper;

    @Override
    public String getPaperStatus(String Id) {
        return drfPapersMapper.getPaperStatus(Id);
    }

    @Override
    public Boolean updatePaperStatus(String id, String status) {
        int rowsAffected = drfPapersMapper.updatePaperStatus(id, status);
        // 如果更新的行数大于0，说明更新成功，返回true；否则返回false
        return rowsAffected > 0 ? Boolean.TRUE : Boolean.FALSE;
    }

    @Override
    public void updateStatus(String id, String reviewEnd) {
        drfPapersMapper.updateStatus(id, reviewEnd);
    }

    @Override
    public List<DrfPapers> getPaperByUserId(String userId) {
        return drfPapersMapper.getPaperByUserId(userId);
    }

    @Override
    public List<DrfPapers> getHistoryPapers(String userId) {

        return drfPapersMapper.getHistoryPapers(userId);
    }

    @Override
    public DrfPapers getPaperByFileId(Integer fileId) {

        return drfPapersMapper.getPaperByFileId(fileId);
    }

}